package com.example.kotlin

sealed class NetworkResult
data class Success(val data: String) : NetworkResult()
data class Error(val message: String) : NetworkResult()

fun handleResult(result: NetworkResult) {
    when (result) {
        is Success -> println("Data: ${result.data}")
        is Error -> println("Error: ${result.message}")
    }
}

fun main(args: Array<String>) {

    handleResult(Success("hello world"))
    handleResult(Error("error"))


}